package com.alo.alowebproject.business;
import java.util.Iterator;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/* @author Alo
 * @
*/
public class AccountBusiness {
	SessionFactory sf = new Configuration().configure().buildSessionFactory();
	Session session = sf.openSession();
	Query q;
	
	public boolean isAccount(String username, String password, String pwd2){
		q = session.createQuery("from Account as a where a.username='"+username+"' and a.password='"+password+"'");
		Iterator itar = q.list().iterator();
		if(itar.hasNext()&&password.equals(pwd2)){
			return true;
		}
		else
			return false;
	}
	
	public List Info(String username, String password){
		q = session.createQuery("from Account as a");
		List showInfo = q.list();
		return showInfo;
	}
}
